using System;
using System.Collections.Generic;
using System.Text;
using Db4objects.Db4o;
using System.IO;

namespace MonitorTemperatura.DataAccess
{

    public class Util
    {
        // Fields
        public static readonly string ServerPassword = "password";
        public static readonly int ServerPort = 0xdb40;
        public static readonly string ServerUser = "user";
        //public static readonly string YapFileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "MonitorTemperaturaDB.yap");
        public static readonly string YapFileName = "MonitorTemperaturaDB.yap";
        public static readonly string PASS = "db4o";
        public static readonly string HOST = "localhost";
        public static readonly int PORT = 0x1188;
        public static readonly string USER = "db4o";

        // Methods
        public static void DeleteAll(IObjectContainer db)
        {
            object obj = new object();
            IObjectSet set = db.QueryByExample(obj);
            foreach (object obj2 in set)
            {
                db.Delete(obj2);
            }
        }

        public static void ListRefreshedResult(IObjectContainer container, IObjectSet items, int depth)
        {
            Console.WriteLine(items.Count);
            foreach (object obj2 in items)
            {
                container.Ext().Refresh(obj2, depth);
                Console.WriteLine(obj2);
            }
        }

        public static void ListResult(IObjectSet result)
        {
            Console.WriteLine(result.Count);
            foreach (object obj2 in result)
            {
                Console.WriteLine(obj2);
            }
        }

        public static void RetrieveAll(IObjectContainer db)
        {
            ListResult(db.QueryByExample(typeof(object)));
        }      
    }
}